import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int elect = 0;
        for (int i = 0; i < n; i++) {
            elect = sc.nextInt();
            int id = sc.nextInt();
            String name = sc.next();
            int bir = sc.nextInt();
            String x = sc.next();
            double y = sc.nextDouble();
            if (elect == 0) {
                Student stu = new Student(id, name, bir, x, y);
                stu.ToString();
            } else {
                Teacher tea = new Teacher(id, name, bir, x, y);
                tea.ToString();
            }
        }
    }

    abstract static class Person {
        int id;
        String name;
        int bir;

        Person(int id, String name, int bir) {
            this.id = id;
            this.name = name;
            this.bir = bir;
        }
    }

    static class Student extends Person {
        String major;
        double score;

        Student(int id, String name, int bir, String major, double score) {
            super(id, name, bir);
            this.major = major;
            this.score = score;
        }

        public void ToString() {
            System.out.println("Student [id=" + this.id + ", name=" + name + ", bir=" + bir +
                    ", major=" + major + ", score=" + score + "]\n");
        }
    }

    static class Teacher extends Person {
        String title;
        double salary;

        Teacher(int id, String name, int bir, String title, double salary) {
            super(id, name, bir);
            this.title = title;
            this.salary = salary;
        }

        public void ToString() {
            System.out.println("Teacher [id=" + id + ", name=" + name + ", bir=" + bir +
                    ", title=" + title + ", salary=" + salary + "]\n");
        }
    }
}